package cn.wubo.vrr.help.service.impl;

import cn.wubo.vrr.help.entity.Education;
import cn.wubo.vrr.help.repository.EducationRepo;
import cn.wubo.vrr.help.service.EducationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EducationServiceImpl implements EducationService {
    @Autowired
    EducationRepo educationRepo;

    @Override
    public List<Education> saveOrUpdateAll(List<Education> list) {
        if(list.size() > 0){
            Education query = new Education();
            query.setEMPLID(list.get(0).getEMPLID());
            educationRepo.deleteAll(educationRepo.findAll(Example.of(query)));
            list = educationRepo.saveAll(list);
        }
        return list;
    }
}
